Enhanced virtual machine instructions

ABSTRACT

Techniques for implementing virtual machine instructions suitable for execution in virtual machines are disclosed. The operations performed by conventional instructions can be performed by relatively fewer inventive virtual machine instructions. Furthermore, the virtual machine instructions can be used to perform operations that cannot readily be performed by conventional Java Bytecode instructions. Thus, a more elegant, yet robust, virtual machine instruction set can be implemented.

CROSS-REFERENCE TO RELATED APPLICATIONS

[0001] This application is related to U.S. patent application Ser. No.______ (Att. Dkt.No. SUN1P811/P5512), entitled “REDUCED INSTRUCTION SETFOR JAVA VIRTUAL MACHINES”, filed on an even date, and herebyincorporated herein by reference for all purposes.

[0002] This application is related to U.S. patent application Ser. No.09/703,361 (Att.Dkt.No. SUN1P809/P5500), entitled “IMPROVED FRAMEWORKSFOR INVOKING METHODS IN VIRTUAL MACHINES”, which is hereby incorporatedherein by reference for all purposes.

[0003] This application is related to U.S. patent application Ser. No.09/703,356 (Att.Dkt.No. SUN1P810/P5510), entitled “IMPROVED METHODS ANDAPPARATUS FOR NUMERIC CONSTANT VALUE INLINING IN VIRTUAL MACHINES”,which is hereby incorporated herein by reference for all purposes.

[0004] This application is related to U.S. patent application Ser. No.09/703,449 (Att.Dkt.No. SUN1P814/P5417), entitled “IMPROVED FRAMEWORKSFOR LOADING AND EXECUTION OF OBJECT-BASED PROGRAMS”, which is herebyincorporated herein by reference for all purposes.

BACKGROUND OF THE INVENTION

[0005] The present invention relates generally to object-based highlevel programming environments, and more particularly, to virtualmachine instruction sets suitable for execution in virtual machinesoperating in portable, platform independent programming environmentsRecently, the Java™ programming environment has become quite popular.The Java™ programming language is a language that is designed to beportable enough to be executed on a wide range of computers ranging fromsmall devices (e.g., pagers, cell phones and smart cards) up tosupercomputers. Computer programs written in the Java programminglanguage (and other languages) may be compiled into Java Bytecodeinstructions that are suitable for execution by a Java virtual machineimplementation.

[0006] The Java virtual machine is commonly implemented in software bymeans of an interpreter for the Java virtual machine instruction setbut, in general, may be software, hardware, or both. A particular Javavirtual machine implementation and corresponding support libraries,together constitute a Java™ runtime environment.

[0007] Computer programs in the Java programming language are arrangedin one or more classes or interfaces (referred to herein jointly asclasses or class files). Such programs are generally platform, i.e.,hardware and operating system, independent. As such, these computerprograms may be executed without modification, on any computer that isable to run an implementation of the Java™ runtime environment. A classwritten in the Java programming language is compiled to a particularbinary format called the “class file format” that includes Java virtualmachine instructions for the methods of a single class. In addition tothe Java virtual machine instructions for the methods of a class, theclass file format includes a significant amount of ancillary informationthat is associated with the class. The class file format (as well as thegeneral operation of the Java virtual machine) is described in somedetail in The Java Virtual Machine Specification by Tim Lindholm andFrank Yellin (ISBN 0-201-31006-6), which is hereby incorporated hereinby reference.

[0008] Conventional virtual machines interpreter decodes and executesthe Java Bytecode instructions, one instruction at a time duringexecution, e.g., “at runtime.” To execute a Java instruction, typically,several operations have to been performed to obtain the information thatis necessary to execute the Java instruction. For example, to invoke amethod referenced by a Java bytecode, the virtual machine must performseveral operations to access the Constant Pool simply to identify theinformation necessary to locate and access the invoked method.

[0009] As described in The Java Virtual Machine Specification, one ofthe structures of a standard class file is known as the “Constant Pool.”The Constant Pool is a data structure that has several uses. One of theuses of the Constant Pool that is relevant to the present invention isthat the Constant Pool contains the information that is needed toresolve various Java Instructions. To illustrate, FIG. 1 depicts aconventional computing environment 100 including a stream of JavaBytecodes 102, a constant pool 104 and an execution stack 106. Thestream of Java Bytecodes 102 represents a series of bytes in a streamwhere one or more bytes can represent a Java Bytecode instruction. Forexample, a byte 108 can represent a Ldc (load constant on the executionstack) Bytecode command 108. Accordingly, the bytes 110 and 112represent the parameters for the Ldc Bytecode command 108. In this case,these bytes respectively represent a CP-IndexA 100 and CP-IndexB 112that collectively represent the index to appropriate constant value inthe constant pool 104. For example, bytes C1, C2, C3 and C4 of theconstant pool 104 can collectively represent the appropriate 4 byte (oneword) constant C that is to loaded to the top of the execution stack106. It should be noted that Ldc Bytecode command 108 and its parametersrepresented by bytes 110 and 112 are collectively referred to herein asa Java Bytecode instruction.

[0010] In order to execute the Java Bytecode Ldc Instruction 108, at runtime, an index to the Constant Pool 104 is constructed from theCP-IndexA and CP-IndexA. Once an index to the Constant Pool has beendetermined, the appropriate structures in the Constant Pool have to beaccessed so that the appropriate constant value can be determined.Accordingly, the Java Bytecode Ldc instruction can be executed onlyafter performing several operations at run time. As can be appreciatedfrom the example above, the execution of a relatively simple instructionsuch as loading a constant value can take a significant amount of runtime. Hence, this conventional technique is an inefficient approach thatmay result in significantly longer execution times.

[0011] Another problem is that the conventional Java Bytecodeinstruction set has more than 220 instructions. Moreover, there is asignificant amount of redundancy between some instructions in theconventional Java Bytecode instruction set. For example, there aredifferent Java Bytecode instructions for storing (or pushing) integerlocal variables on the execution stack (e.g., iLoad), and storing (orpushing) a pointer local variable on the execution stack (e.g., aLoad).However, the operations performed by these instructions are virtuallyidentical, namely, storing (or pushing) 4 byte values (a word) on theexecution stack. There is also a significant amount of overlap betweensome instructions of the conventional Java Bytecode instruction set. Forexample, there are 5 different Java Bytecode instructions for pushingone byte integer values on the execution stack (i.e., iconst_(—)1,iconst_(—)2, iconst_(—)3, iconst_(—)4 and iconst_(—)5). However, theseoperations virtually perform the same operations, namely, pushing aconstant one byte integer value on the execution stack.

[0012] As noted above, the Java Bytecode instruction set has more than220 instructions. This means that conventionally nearly all of the 256(2⁸) allowable Bytecode values have to be assigned to Java instructions(commands or opcodes). As a result, Java interpreters are needlesslycomplex since they need to recognize a relatively large number of Javainstructions and possibly implement various mechanisms for executingmany instructions. Thus, the conventional Java Bytecode instruction setis not a very desirable solution for systems with limited resources(e.g., embedded systems)

[0013] Accordingly, there is a need for alternative instructionssuitable for execution in virtual machines.

SUMMARY OF THE INVENTION

[0014] To achieve the foregoing and other objects of the invention,techniques for implementing virtual machine instructions suitable forexecution in virtual machines are disclosed. The inventive virtualmachine instructions can effectively represent the complete set ofoperations performed by the conventional Java Bytecode instruction set.Moreover, the operations performed by conventional instructions can beperformed by relatively fewer inventive virtual machine instructions.Furthermore, the inventive virtual machine instructions can be used toperform operations that cannot readily be performed by conventional JavaBytecode instructions. Thus, a more elegant yet robust virtual machineinstruction set can be implemented. This in turn allows implementationof relatively simpler interpreters as well as allowing alternative usesof the limited 256 (2⁸) Bytecode representation (e.g., a macrorepresenting a set of commands). As a result, the performance of virtualmachines, especially, those operating in systems with limited resources,can be improved.

[0015] The invention can be implemented in numerous ways, including asystem, an apparatus, a method or a computer readable medium. Severalembodiments of the invention are discussed below.

[0016] As a set of virtual machine instructions suitable for executionin a virtual machine to load constant values on an execution stack, oneembodiment of the invention provides instructions representing a numberof corresponding Java Bytecode executable instructions that are alsosuitable for execution in the virtual machine to load constant values onan execution stack. The set of the virtual machine instructions consistsof a number of virtual machine instructions that is less than the numberof the corresponding Java Bytecode executable instructions. In addition,every one of the corresponding Java Bytecode executable instructions canbe represented by at least one of the virtual machine instructions inthe virtual machine instruction set.

[0017] As a set of virtual machine instructions suitable for executionin a virtual machine to store local variables onto an execution stack,one embodiment of the invention provides virtual machine instructionsrepresenting a number of corresponding Java Bytecode executableinstructions that are also suitable for execution in the virtual machineto store local variables onto an execution stack. The set of virtualmachine instructions consists of a number of virtual machineinstructions that is less than the number of the corresponding JavaBytecode executable instructions. In addition, every one of thecorresponding Java Bytecode executable instructions can be representedby at least one of the virtual machine instructions in the virtualmachine instruction set.

[0018] As a virtual machine instruction suitable for execution in avirtual machine to load values from arrays on an execution stack, oneembodiment of the invention provides a virtual machine instructionrepresenting two or more Java Bytecode executable instructions that arealso suitable for loading values from arrays on the execution stack.

[0019] As a virtual machine instruction suitable for execution in avirtual machine to store values located on an execution stack intoarrays, one embodiment of the invention provides a virtual machineinstruction representing two or more Java Bytecode executableinstructions that are also suitable for storing values located on anexecution stack into an array.

[0020] One embodiment of the invention provides a virtual machineinstruction suitable for execution in a virtual machine to duplicatevalues stored in an execution stack on top of the execution stack. Thevirtual machine instruction represents two or more Java Bytecodeexecutable instructions that are also suitable for duplicating valuesstored in the execution stack on top of the execution stack.

[0021] Another embodiment of the invention provides a virtual machineinstruction suitable for execution in a virtual machine to duplicatevalues stored in an execution stack on top of the execution stack,wherein the virtual machine instruction has a parameter associated withit to indicate which value stored in the execution stack should beduplicated on the top of the stack.

[0022] As a virtual machine instruction suitable for execution in avirtual machine, one embodiment of the invention operates to returnvalues by placing them on top of an execution stack. The virtual machineinstruction represents two or more Java Bytecode executable instructionsthat are also suitable for returning values by placing them on top ofthe execution stack.

[0023] Other aspects and advantages of the invention will becomeapparent from the following detailed description, taken in conjunctionwith the accompanying drawings, illustrating by way of example theprinciples of the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The present invention will be readily understood by the followingdetailed description in conjunction with the accompanying drawings,wherein like reference numerals designate like structural elements, andin which:

[0025]FIG. 1 depicts a conventional computing environment including astream of Java Bytecodes, a constant pool, and an execution stack.

[0026]FIG. 2A is a block diagram representation of a computingenvironment including a Java Bytecode instruction translator inaccordance with one embodiment of the invention.

[0027]FIG. 2B illustrates a mapping that can be performed by the JavaBytecode instruction translator of FIG. 2A in accordance with oneembodiment of the invention.

[0028]FIG. 3 illustrates an internal representation of Java instructionsin accordance with one embodiment of the invention.

[0029]FIG. 4A illustrates an internal representation of a set of JavaLoad Constant Bytecode instructions in accordance with one embodiment ofthe invention.

[0030]FIG. 4B illustrates a set of conventional Java Bytecodeinstructions that can be represented by an inventive Push command.

[0031]FIG. 4C illustrates an internal representation of a set ofconventional Java Load Constant Bytecode instructions in accordance withanother embodiment of the invention.

[0032]FIG. 4D illustrates a set of conventional Java Bytecodeinstructions that can be represented by a single PushL command inaccordance with one embodiment of the invention.

[0033]FIG. 4E illustrates an internal representation of a set of JavaLoad Constant Bytecode instructions in accordance with yet anotherembodiment of the invention.

[0034]FIG. 4F illustrates a set of Java Bytecode instructions that canbe represented by a single PushB command in accordance with oneembodiment of the invention.

[0035]FIG. 5A illustrates an internal representation of a set of JavaLoad from a local variable instructions in accordance with anotherembodiment of the invention.

[0036]FIG. 5B illustrates a set of Java Bytecode instructions forloading 4 byte local variables that can be represented by an inventiveLoad command in accordance with one embodiment of the invention.

[0037]FIG. 5C illustrates a set of Java Bytecode instructions forloading 8 byte local variables in accordance with one embodiment of theinvention.

[0038]FIG. 6A illustrates a computing environment including an Aload(load from array) virtual machine instruction in accordance with oneembodiment of the invention.

[0039]FIG. 6B illustrates a set of conventional Java Bytecodeinstructions for loading arrays that can be represented by a singleinventive virtual machine instruction in accordance with one embodimentof the invention.

[0040]FIG. 6C illustrates a computing environment including an AStore(store into array) virtual machine instruction in accordance with oneembodiment of the invention.

[0041]FIGS. 6D and 6E illustrate a set of conventional Java Bytecodeinstructions for storing arrays that can be represented by a singleinventive virtual machine instruction.

[0042]FIGS. 6F and 6G illustrate some Java conventional Bytecodeinstructions for performing conditional flow operations which can berepresented by two inventive virtual machine instructions in accordancewith one embodiment of the invention.

[0043]FIG. 7A illustrates a computing environment including an internalrepresentation of a DUP instruction suitable for duplicating values onthe stack in accordance with one embodiment of the invention.

[0044]FIGS. 7B and 7C illustrate various Java Bytecode instructions thatcan be represented by an inventive virtual machine instruction inaccordance with one embodiment of the invention.

[0045]FIGS. 8A and 8B illustrate mapping of Java Bytecode returninstructions to virtual machine instructions provided in accordance withone embodiment of the invention.

[0046]FIG. 9 illustrates a mapping of Java Bytecode instantiationinstructions to the virtual machine instructions provided in accordancewith one embodiment of the invention

DETAILED DESCRIPTION OF THE INVENTION

[0047] As described in the background section, the Java programmingenvironment has enjoyed widespread success. Therefore, there arecontinuing efforts to extend the breadth of Java compatible devices andto improve the performance of such devices. One of the most significantfactors influencing the performance of Java based programs on aparticular platform is the performance of the underlying virtualmachine. Accordingly, there have been extensive efforts by a number ofentities to improve performance in Java compliant virtual machines.

[0048] To achieve this and other objects of the invention, techniquesfor implementing virtual machine instructions suitable for execution invirtual machines are disclosed. The inventive virtual machineinstructions can effectively represent the complete set of operationsperformed by the conventional Java Bytecode instruction set. Moreover,the operations performed by conventional instructions can be performedby relatively fewer inventive virtual machine instructions. Furthermore,the inventive virtual machine instructions can be used to performoperations that cannot readily be performed by the conventional JavaBytecode instructions. Thus, a more elegant yet robust virtual machineinstruction set can be implemented. This, in turn, allows implementationof relatively simpler interpreters as well as allowing for alternativeuses of the limited 256 (2⁸) Bytecode representation (e.g., a macrorepresenting a set of commands). As a result, the performance of virtualmachines, especially, those operating in systems with limited resources,can be improved.

[0049] Embodiments of the invention are discussed below with referenceto FIGS. 2-9. However, those skilled in the art will readily appreciatethat the detailed description given herein with respect to these figuresis for explanatory purposes only as the invention extends beyond theselimited embodiments.

[0050]FIG. 2A is a block diagram representation of a computingenvironment 200 including a Java Bytecode instruction translator 202 inaccordance with one embodiment of the invention. The Java Bytecodeinstruction translator 202 operates to convert one or more bytes of aJava Bytecode stream 204, representing a Java Bytecode instruction 205into a virtual machine instruction 206 containing one or more bytes. TheJava Bytecode instruction 205 in the Java Bytecode stream 204 can be,for example, a “Lcd” command 108 with its associated parameters 110 and112, as described in FIG. 1.

[0051] Typically, one byte of the virtual machine instruction 206 isdesignated to represent a virtual machine command (or opcode). Inaddition, one or more additional bytes may be associated with thevirtual machine command (or opcode) to represent its parameters. As aresult, one or more bytes of the virtual machine instruction 206 canrepresent a Java Bytecode instruction having one or more bytes thatcollectively represent a Java Bytecode instruction, namely a command andpossibly the parameters associated with the command (e.g., a one byteJava iconst_(—)1 Bytecode instruction, three bytes representing JavaBytecode Lcd instruction, etc).

[0052] As will be appreciated, the virtual machine instruction 206 canrepresent similar virtual machine operations that the Java Bytecodeinstruction 205 represents. In addition, the virtual machine instruction206 can be loaded by a virtual machine instruction loader 208 into avirtual machine 210 as an internal representation 212. As will becomeapparent, the internal representation 212 can be used to significantlyimprove the performance of the virtual machine.

[0053] Furthermore, the Java Bytecode instruction translator 202 iscapable of converting a set of Java Bytecode executable instructionsinto a more elegant set of instructions that is especially suitable forsystems with limited resources. The operations performed by aconventional Bytecode instruction set can effectively be represented byfewer inventive virtual machine instructions. Accordingly, the number ofthe executable virtual machine instructions can be significantly lessthan the number of conventional Java Bytecode executable instructionsneeded to perform the same set of operations. In other words, two ormore distinct conventional Java Bytecode executable instructions caneffectively be mapped into an inventive virtual machine instruction.

[0054] To elaborate, FIG. 2B illustrates a mapping 250 that can beperformed, for example, by the Java Bytecode instruction translator 202in accordance with one embodiment of the invention. As illustrated inFIG. 2B, a set of conventional Java Bytecode executable instructions 252can be mapped into a corresponding set of inventive virtual machineinstructions 254. It should be noted that the set of Java Bytecodeexecutable instructions 252 consists of M instructions, BytecodeInstructions (BC₁-BC_(M)). It should also be noted that each of the Bytecode Instructions BC₁-BC_(M) represent a unique instruction in the setof Java Bytecode executable instructions 252. As will be appreciated,the corresponding set of executable virtual machine instructions 254consists of N instructions (AVM₁-AVM_(N)), a number that can besignificantly less than M (the number of Java Bytecode executableinstructions 252). Accordingly, two or more Byte code Instructions ofthe Java Bytecode executable instructions 252 can be mapped into thesame executable virtual machine instruction. For example, BytecodeInstructions BC_(i), BC_(j) and BC_(k)can all be mapped into the samevirtual machine executable instruction, namely, the instruction AVM₁. Inaddition, as will be described below, two or more inventive virtualmachine instructions from the set 254 can be combined to effectivelyrepresent a Java Bytecode instruction in the set 252.

[0055] As noted above, a virtual machine instruction, for example, theinstruction AVM₁, can be loaded by a virtual machine instruction loaderinto a virtual machine as an internal representation that can be used tosignificantly improve the performance of the virtual machine. FIG. 3illustrates an internal representation 300 in accordance with oneembodiment of the invention. The internal representation 300 can, forexample, be implemented as a data structure embodied in a computerreadable medium that is suitable for use by a virtual machine. As shownin FIG. 3, the internal representation 300 includes a pair of streams,namely, a code stream 302 and a data stream 304.

[0056] It should be noted that conventionally Java Bytecode instructionsare internally represented as a single stream in the virtual machine.However, as shown in FIG. 3, the internal representation 300 includes apair of streams, namely, a code stream 302 and a data stream 304. Moredetails about representing instructions as a pair of streams can befound in the U.S. patent application Ser. No. 09/703,449 (Att.Dkt.No.SUN1P814/P5417), entitled “IMPROVED FRAMEWORKS FOR LOADING AND EXECUTIONOF OBJECT-BASED PROGRAMS”.

[0057] Each one of the entries in the code stream 302 and/or data stream304 represent one or more bytes. The code stream 302 includes variousvirtual machine commands (or instructions) 306, 308 and 310. The virtualmachine commands (or instruction) 306 represents a virtual machineinstruction that does not have any parameters associated with it. On theother hand, each of the virtual machine commands B and C have associateddata parameters that are represented in the data stream 304. Moreparticularly, data B is the corresponding data parameter of the virtualmachine command B, and data C1 and C2 are the data parameters associatedwith the command C.

[0058] It should be noted that the inventive virtual machine command Band data B represents one or more conventional Java Bytecodes which havebeen converted, for example, by the Java Bytecode instruction translator202 of FIG. 2A. Similarly, the virtual machine command C, data C1 and C2collectively represent the one or more Java Bytecodes that have beenconverted into an inventive virtual machine instruction with itsappropriate data parameters.

[0059]FIG. 4A illustrates an internal representation 400 of a set ofJava Load Constant Bytecode instructions in accordance with oneembodiment of the invention. The internal representation 400 can, forexample, be implemented as a data structure embodied in a computerreadable medium that is suitable for use by a virtual machine.

[0060] In the described embodiment, each entry in the code stream 402and data stream 404 represents one byte. As such, the code stream 402includes a one byte Push command 406, representing an inventive virtualmachine command suitable for representation of one or more conventionalJava Load Constant Bytecode instructions. The data stream 404 includesthe data parameters associated with the Push command 406, namely, bytesA, B, C and D. As will be appreciated, at execution time, the virtualmachine can execute the Push command 406. Accordingly, the valuerepresented by the bytes A, B, C and D in the data stream 404 can bepushed on the execution stack. In this way, the Push command 406 caneffectively represent various Java Bytecode instructions that pushvalues represented by 4 bytes (one word) on the execution stack at runtime. FIG. 4B illustrates a set of conventional Java Bytecodeinstructions that can be represented by an inventive Push command (e.g.,Push command 406).

[0061]FIG. 4C illustrates an internal representation 410 of a set ofconventional Java Load Constant Bytecode instructions in accordance withanother embodiment of the invention. Similar to the internalrepresentation 400 of FIG. 4A, the internal representation 410 includesa pair of streams, namely, the code stream 402 and data stream 404,wherein each entry in the streams represents one byte. However, in FIG.4B, the code stream 402 includes a one byte PushL command 412,representing another inventive virtual machine instruction suitable forrepresentation of one or more Java Load Constant Bytecode instructions.It should be noted that the PushL command 412 has 8 bytes of dataassociated with it, namely, the bytes represented by A, B, C, D, E, F, Gand H in the data stream 404. At execution time, the virtual machine canexecute the PushL command 412 to push the value represented by the bytesA, B, C, D, E, F, G and H in the data stream 404, on the top of theexecution stack. Accordingly, the PushL command 412 can effectivelyrepresent various Java Bytecode instructions that push 8 byte (two word)values on the execution stack at run time. FIG. 4D illustrates a set ofconventional Java Bytecode instructions that can be represented by asingle PushL command (e.g., PushL command 412) in accordance with oneembodiment of the invention.

[0062]FIG. 4E illustrates an internal representation 420 of a set ofJava Load Constant Bytecode instructions in accordance with yet anotherembodiment of the invention. Again, the internal representation 420includes the code stream 402 and data stream 404, wherein each entry inthe streams represents one byte. However, in FIG. 4E, the code stream402 includes a one byte PushB command 422, representing yet anotherinventive virtual machine instruction suitable for representation of oneor more Java Load Constant Bytecode instructions. It should be notedthat the PushB command 422 has a one byte data parameter A associatedwith it. As shown in FIG. 4E, the data parameter can be stored in thecode stream 402. However, it should be noted that in accordance withother embodiment of the invention, the data parameter A can be stored inthe data stream 404. In any case, the PushB command 422 can effectivelyrepresent various Java Bytecode instructions that push one byte valueson the execution stack at run time. FIG. 4F illustrates a set of JavaBytecode instructions that can be represented by a single PushB command(e.g., PushB command 422) in accordance with one embodiment of theinvention.

[0063]FIG. 5A illustrates an internal representation 500 of a set ofJava “Load from a local variable” instructions in accordance withanother embodiment of the invention. In the described embodiment, a codestream 502 of the internal representation 500 includes a Load command506, representing an inventive virtual machine instruction suitable forrepresentation of one or more Java “Load from a local variable” Bytecodeinstructions. It should be noted that the Load command 506 has a onebyte parameter associated with it, namely, an index_(i) 508 in the datastream 504. As will be appreciated, at run time, the Load command 506can be executed by a virtual machine to load (or push) a local variableon top of the execution stack 520. By way of example, an offset₀ 522 canindicate the starting offset for the local variables stored on theexecution stack 520. Accordingly, an offset_(i) 524 identifies theposition in the execution stack 520 which corresponds to the index 508shown in FIG. 5A.

[0064] It should be noted that in the described embodiment, the Loadcommand 506 is used to load local variables as 4 bytes (one word). As aresult, the value indicated by the 4 bytes A, B, C and D (starting atoffset_(i) 524) is loaded on the top of the execution stack 520 when theLoad command 506 is executed. In this manner, the Load command 506 andindex_(i) 508 can be used to load (or Push) 4 byte local variables ontop of the execution stack at run time. As will be appreciated, the Loadcommand 506 can effectively represent various conventional Java Bytecodeinstructions. FIG. 5B illustrates a set of Java Bytecode instructionsfor loading 4 byte local variables that can be represented by aninventive Load command (e.g., Load command 412) in accordance with oneembodiment of the invention.

[0065] It should be noted that the invention also provides for loadinglocal variables that do not have values represented by 4 bytes. Forexample, FIG. 5C illustrates a set of Java Bytecode instructions forloading 8 byte local variables in accordance with one embodiment of theinvention. As will be appreciated, all of the Java Bytecode instructionslisted in FIG. 5C can be represented by a single inventive virtualmachine instruction (e.g., a LoadL command). The LoadL command canoperate, for example, in a similar manner as discussed above.

[0066] In addition, the invention provides for loading values fromarrays into an execution stack. By way of example, FIG. 6A illustrates acomputing environment 600 in accordance with one embodiment of theinvention. The computing environment 600 includes an array 602representative of a Java array stored in a portion of a memory of thecomputing environment 600. An execution stack 604 is also depicted inFIG. 6. As will be appreciated, an inventive virtual machine instructionALoad (array load) 605 can be utilized to facilitate loading of variousvalues from the array 602 to the top of the execution stack 604.

[0067] During the execution of the virtual machine instruction ALoad605, an array-reference 606 can be utilized (e.g., resolved) todetermine the location of the array 602. In addition, an array-index 608can be used to identify the appropriate offset of the array 602 andthereby indicate the appropriate value that is to loaded from the array602 on the execution stack 604. As will be appreciated, the inventivevirtual machine instruction ALoad can be used to load the appropriatevalues from various types of arrays (e.g., 1 byte, 2 bytes, 4 bytes, 8bytes arrays). To achieve this, a header 610 of the array 602 can beread to determine the arrays' type. Accordingly, based on the type ofthe array 602 as indicated by the header 610, the appropriate value thatis to be loaded from the array can be determined by using thearray-index 608. This value can then be loaded onto the top of theexecution stack 604.

[0068] Thus, the inventive virtual machine instruction ALoad caneffectively represent various Java Bytecode instructions that are usedto load values from an array. FIG. 6B illustrates a set of conventionalJava Bytecode instructions for loading arrays that can be represented bya single inventive virtual machine instruction (e.g., ALoad) inaccordance with one embodiment of the invention.

[0069] As will be appreciated, the invention also provides for virtualmachine instructions used to store values into arrays. By way ofexample, FIG. 6C illustrates a computing environment 620 in accordancewith one embodiment of the invention. An inventive AStore 622 (storeinto array) virtual machine instruction can be used to store variousvalues from the execution stack 604 into different types of arrays inaccordance with on embodiment of the invention. Again, the header 610 ofthe array 602 can be read to determine the array's type. Based on thearray's type, the appropriate value (i.e., the appropriate number ofbytes N on the execution stack 604 of FIG. 6B) can be determined. Thisvalue can then be stored in the array 602 by using the array-index 626.Thus, the inventive virtual machine instruction ALoad can effectivelyrepresent various Java Bytecode instructions that are used to storevalues into an array. FIGS. 6D and 6E illustrate a set of conventionalJava Bytecode instructions for storing arrays that can be represented byan inventive virtual machine instruction (e.g., Astore) in accordancewith one embodiment of the invention.

[0070] Still further, two or more of the inventive virtual machineinstructions can be combined to perform relatively more complicatedoperations in accordance with one embodiment of the invention. By way ofexample, the conditional flow control operation performed by the JavaBytecode instruction “Icmp” (compare two long values on the stack andbased on the comparison push 0 or 1 on the stack) can effectively beperformed by performing an inventive virtual machine instruction LSUB(Long subdivision) followed by another inventive virtual machineinstruction JMPEQ (Jump if equal). FIGS. 6F and 6G illustrate some Javaconventional Bytecode instructions for performing conditional flowoperations which can be represented by two inventive virtual machineinstructions in accordance with one embodiment of the invention.

[0071] The invention also provides for inventive operations that cannotbe performed by Java Bytecode instructions. By way of example, aninventive virtual machine operation “DUP” is provided in accordance withone embodiment of the invention. The inventive virtual machineinstruction DUP allows values in various positions on the executionstack to be duplicated on the top of the execution stack. FIG. 7Aillustrates a computing environment 700 including an internalrepresentation 701 of a DUP instruction 702 suitable for duplicatingvalues on the stack in accordance with one embodiment of the invention.The internal representation 701 includes a pair of streams, namely, acode stream 402 and a data stream 404. In the described embodiment, eachentry in the code stream 402 and data stream 404 represents one byte.The inventive virtual machine instruction DUP 702 is associated with adata parameter A in the code stream 402. Again, it should be noted thatData parameter A can be implemented in the data stream 404. In any case,the data parameter A indicates which 4 byte value (word value) on anexecution stack 704 should be duplicated on the top of the executionstack 704. The data parameter A can indicate, for example, an offsetfrom the top of the execution stack 704. As shown in FIG. 7A, the dataparameter A can be a reference to W_(i), a word (4 byte) value on theexecution stack. Accordingly, at execution time, the virtual machine canexecute the DUP command 702. As a result, the W_(i) word will beduplicated on the top of the stack. Thus, as will be appreciated, theinventive DUP virtual machine instructions can effectively replacevarious Java Byte instructions that operate to duplicate 4 byte valueson top of the execution. FIG. 7B illustrates some of these Java Bytecodeinstructions. Similarly, as illustrated in FIG. 7C, an inventive DUPLvirtual machine can be provided to effectively replace various JavaBytecode instructions that operate to duplicate 8 byte values (2 words)on top of the execution stack.

[0072] It should be noted that conventional Java Bytecode instructionsonly allow for duplication of values in certain positions on theexecution stack (i.e, dup, dup_x1 and dupx2 respectively allowduplication of W1, W2 and W3 on the stack). However, the inventivevirtual machine instructions DUP and DUPL can be used to duplicate amuch wider range of values on the execution stack (e.g., W4, Wi, WN,etc.)

[0073]FIGS. 8A and 8B illustrate mapping of Java Bytecode “Return”instructions to virtual machine instructions provided in accordance withone embodiment of the invention. As shown in FIG. 8A, various JavaBytecode instructions can be effectively mapped into a Return virtualmachine instruction. As will be appreciated, the Return virtual machineinstruction operates to put 4 byte values (one word) on the executionstack in a similar manner as the virtual machine instructions forloading constants on the stack described above (e.g., iload). FIG. 8Billustrates a mapping of Java Bytecode return instructions to a“Lreturn” virtual machine instruction that can operate to put 8 bytevalues (two words) on the execution stack.

[0074] In a similar manner, FIG. 9 illustrates a mapping of JavaBytecode instantiation instructions to the virtual machine instructionsprovided in accordance with one embodiment of the invention. Again, thefour various Java Bytecode instructions can be effectively mapped into avirtual machine instruction (e.g., NEW). The virtual machine instructionNEW operates to instantiate objects and arrays of various types. In oneembodiment, the inventive virtual machine instruction NEW operates todetermine the types of the objects or arrays based on the parametervalue of the Bytecode instantiation instructions. As will beappreciated, the Bytecode instructions for instantiation are typicallyfollowed by a parameter value that indicates the type. Thus, theparameter value is readily available and can be used to allow the NEWvirtual machine instruction to instantiate the appropriate type atexecution time.

[0075] Appendix A illustrates mapping of a set of conventional JavaBytecode instructions to one or more of the inventive virtual machineinstructions listed the in right column.

[0076] The many features and advantages of the present invention areapparent from the written description, and thus, it is intended by theappended claims to cover all such features and advantages of theinvention. Further, since numerous modifications and changes willreadily occur to those skilled in the art, it is not desired to limitthe invention to the exact construction and operation as illustrated anddescribed. Hence, all suitable modifications and equivalents may beresorted to as falling within the scope of the invention.

What is claimed is:
 1. A set of virtual machine instructions suitablefor execution in a virtual machine to load constant values on anexecution stack, the set of virtual machine instructions representing anumber of corresponding Java Bytecode executable instructions that arealso suitable for execution in the virtual machine to load constantvalues on an execution stack, wherein the set of the virtual machineinstructions consists of a number of virtual machine instructions thatis less than the number of the corresponding Java Bytecode executableinstructions, and wherein every one of the corresponding Java Bytecodeexecutable instructions can be represented by at least one of thevirtual machine instructions in the virtual machine instruction set. 2.A set of virtual machine instructions as recited in claim 1, wherein theset consists of a first, a second, and a third instruction, the firstinstruction suitable for pushing one byte values on the execution stack,the second instruction suitable for pushing 4 byte values on theexecution stack, and the third instruction suitable for pushing 8 bytevalues on the execution stack.
 3. A set of virtual machine load constantinstructions as recited in claim 1, wherein the first instructionincludes a code portion and a data portion which are both represented ina code stream in the virtual machine, and wherein the second instructionincludes a code portion and a data portion which are respectivelyrepresented in a code stream and in a data stream in the virtualmachine.
 4. A set of virtual machine instructions as recited in claim 3,wherein the set is suitable to load N byte constant values on theexecution stack, and wherein N is a positive integer.
 5. A set ofvirtual machine instructions suitable for execution in a virtual machineto store local variables onto an execution stack, the set of virtualmachine instructions representing a number of corresponding JavaBytecode executable instructions that are also suitable for execution inthe virtual machine to store local variables onto an execution stack,wherein the set of virtual machine instructions consists of a number ofvirtual machine instructions that is less than the number of thecorresponding Java Bytecode executable instructions, and wherein everyone of the corresponding Java Bytecode executable instructions can berepresented by at least one of the virtual machine instructions in thevirtual machine instruction set.
 6. A set of virtual machineinstructions as recited in claim 5, p1 wherein the set of virtualmachine instructions consists of a first instruction and a secondinstruction, the first instruction being suitable for storing 4 bytelocal variables onto the execution stack, and the second instructionbeing suitable for storing 8 byte local variables onto the executionstack.
 7. A set of virtual machine instructions as recited in claim 5,wherein the first or the second instruction includes a code portion anda data portion which are respectively represented in a code stream andin a data stream in the virtual machine.
 8. A set of virtual machineinstructions as recited in claim 5, wherein the set of set of virtualmachine instructions is suitable to store N byte local variables on theexecution stack, and wherein N is a positive integer.
 9. A virtualmachine instruction suitable for execution in a virtual machine to loadvalues from arrays on an execution stack, the virtual machineinstruction representing two or more Java Bytecode executableinstructions that are also suitable for loading values from arrays onthe execution stack.
 10. A virtual machine instruction as recited inclaim 9, wherein the arrays can be an array of 1 byte values, or anarray of 2 byte values, or an array of 4 byte values, or an array of 8byte values.
 11. A virtual machine instruction as recited in claim 9,wherein a header of an array is read to determine the type of the array.12. A virtual machine instruction suitable for execution in a virtualmachine to store values located on an execution stack into arrays, thevirtual machine instruction representing two or more Java Bytecodeexecutable instructions that are also suitable for storing valueslocated on an execution stack into an array.
 13. A virtual machineinstruction as recited in claim 12, wherein the arrays can be an arrayof 1 byte values, or an array of 2 byte values, or an array of 4 bytevalues, or an array of 8 byte values.
 14. A virtual machine load arrayinstruction as recited in claim 12, wherein a header of an array is readto determine the type of the array.
 15. A virtual machine instructionsuitable for execution in a virtual machine to duplicate values storedin an execution stack on top of the execution stack, the virtual machineinstruction representing two or more Java Bytecode executableinstructions that are also suitable for duplicating values stored in theexecution stack on top of the execution stack.
 16. A virtual machineinstruction as recited in claim 15, wherein values that can beduplicated on the execution stack are not limited to values that arewithin first, second, and third positions from the top of the stack. 17.A virtual machine instruction as recited in claim 15, wherein the valuesduplicated on top of the stack can be 4 byte values or 8 byte values.18. A virtual machine instruction suitable for execution in a virtualmachine to duplicate values stored in an execution stack on top of theexecution stack, wherein the virtual machine instruction has a parameterassociated with it to indicate which value stored in the execution stackshould be duplicated on the top of the stack.
 19. A virtual machineinstruction as recited in claim 18, wherein values that can beduplicated are not limited to values that are within first, second, andthird positions from the top of the execution stack.
 20. A virtualmachine instruction as recited in claim 18, wherein the values can be 4byte values or 8 byte values.
 21. A virtual machine instruction suitablefor execution in a virtual machine to return values by placing them ontop of an execution stack, the virtual machine instruction representingtwo or more Java Bytecode executable instructions that are also suitablefor returning values by placing them on top of the execution stack. 22.A virtual machine instruction as recited in claim 21, wherein the valuesreturned can be 4 byte values or 8 byte values.
 23. A virtual machineinstruction suitable for execution in a virtual machine to instantiateJava objects and arrays, the virtual machine instruction representingtwo or more Java Bytecode executable instructions that are also suitablefor instantiation of Java objects or arrays.
 24. A virtual machineinstruction as recited in claim 23, wherein the instantiation of Javaobjects and arrays are performed by determining the type of the objector array based on a parameter that is associated with the object orarray.